package com.service;

import com.dao.VoucherDao;
import com.entity.TPayVoucher;
import com.entity.vo.Voucher_write_off_Vo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class VocherServiceImpl  implements  VocherService{
    @Autowired
    private VoucherDao voucherDao;

    @Override
    public List<TPayVoucher> Tim_ledger(String date) {
//
        System.err.println(date);
        String[] data = date.split(" ");
//        取到年月日 追加占位符
        String result = data[0];
//        查询分割之后的数据
      List <TPayVoucher> tPayVoucher=  voucherDao.Tim_ledger(result);
        return tPayVoucher;
    }

    @Override
    public List<Voucher_write_off_Vo> Voucher_write_off(Map<String, String> map) {
        String start_time = null, end_time = null;
        if (map.containsKey("start_time")) {
            start_time = map.get("start_time");
        }
        if (map.containsKey("end_time")) {
            end_time = map.get("end_time");
        }
//        PageHelper.startPage(page,limit );
        return voucherDao.Voucher_write_off(start_time,end_time);
    }
}
